﻿<!DOCTYPE html>
<html>
<#assign web_title="债券购买 - ${webname!}p2p网贷平台">
<#include "../../include/resource.html">
<body>
<#assign nid="invest"> <#include "../../include/header.html">
<div id="bond_release">
  <div class="borrow_details">
     <div class="tit"><a style="color: #B1251D;" target="_blank" href="${webroot}/invest/detail.html?borrowid=${borrow.id?c}" title="${borrow.name!'-'}详情">${borrow.name!"-"}详情</a></div>
    <ul class="con clearfix">
      <#include "../../common/function.html"> 
      <li>借款人：${borrowUser.username!"-"} </li>
      <li>借款金额：<font>￥${borrow.account?c}</font> </li>
      <li>年利率：<font>${borrow.apr}%</font></li>
      <li class="time">初审时间：${dateformat(borrow.verify_time)} </li>
      <li class="time">还款方式：<@borrowStyle type = borrow.type isday = borrow.isday style = borrow.style/></li>
    </ul>
  </div>
  <div class="bond_details">
    <div class="tit"> 债券详情 </div>
    <div class="con">
      <table>
       <tr>
          <th>序号 </th>
          <th>待收期数 </th>
          <th>待收本金 </th>
          <th>待收利息 </th>
          <th>待收奖励 </th>
          <th>待收日期</th>
          <th>合计</th>
        </tr>
        <#import "../../common/function.html" as func>
         <#if (collectionList?exists)&&(collectionList?size>0)>
         <#list collectionList as item>
        <tr>
          <td>${item_index + 1}</td>
          <td>${item.order + 1}</td>
          <td>${func.format2(item.capital)}元 </td>
          <td>${func.format2(item.interest)}元 </td>
          <td>${func.format2(item.repay_award?c)}元 </td>
          <td>${dateformat(item.repay_time)} </td>
          <td>${func.format2(item.repay_account)}元 </td>
        </tr>
         </#list>
         <#else><tr><td colspan="6">无符合条件信息！</td></tr>
         </#if>
      </table>
    </div>
  </div>
  <div class="release">
    <div class="tit"> 发布 </div>
   <form action="${webroot}/member/ca/add.html" method="post" onSubmit="return check_form_1()" name="form1">
    <ul class="con clearfix">
      <li>债券价值：<font>${func.format2(caValue)}</font>元</li>
      <li> 转让价格：
        <input type="text" onKeyUp="value=value.replace(/[^0-9.]/g,'')" value="请输入转让价格" name="creditPrice" onfocus="if (value==defaultValue)value=''" onblur="if(!value)value=defaultValue"/>
        元</li>
      <li> 定向密码：<input type="hidden" name="fkId" value="${fkId?c}"/><input type="hidden" name="type" value="${type?c}"/>
        <input  type="password" name="pwd" onfocus="if (value==defaultValue)value=''" onblur="if(!value)value=defaultValue" />
      </li>
      <li> 最晚承接时间：<input name="buyEndTime" onclick="change_picktime()" class="js-datetime hasDatepicker" />
      </li>
      <#if isPublish?? && isPublish == true>
      <li class="btn_li"><input type="submit" name="name" class="bond_btn" value="确认转让"/></li>
      <#else>
       <li class="btn_li"><a class="bond_btn">债权已在转让中</a></li>
      </#if>
    </ul>
    </form>
     <script>
		function check_form_1(){
			var frm = document.forms['form1'];
			var creditPrice = frm.elements['creditPrice'].value;
			var buyEndTime = frm.elements['buyEndTime'].value;
			var errorMsg = '';
			if (creditPrice == "请输入转让价格" ) {
				errorMsg += '请输入此份债权的转让价格' + '。\n';
			}
			if (creditPrice.length == 0 ) {
				errorMsg += '请输入此份债权的转让价格' + '。\n';
			}
			if(parseFloat(creditPrice) <= 0 ) {
				errorMsg += '请输入正确的债权转让价格' + '。\n';
			}
			if (buyEndTime.length == 0 ) {
				errorMsg += '请选择最晚承接时间' + '。\n';
			}
			if (errorMsg.length > 0){
				alert(errorMsg);
				return false;
			} else{
				if(confirm("确定要转让此债权吗？确定后，转让价格不能修改。")){
					return true;
				}
				return false;
			}
		}
		</script>
  </div>
</div>
<#include "../../include/footer.html">
</body>
</html>
